cc_library(
  modify_op_lock_and_record_event_pass
  SRCS modify_op_lock_and_record_event_pass.cc
  DEPS computation_op_handle scale_loss_grad_op_handle op_graph_view
       multi_devices_helper)

cc_library(
  multi_devices_graph_print_pass
  SRCS multi_devices_graph_print_pass.cc
  DEPS multi_devices_helper)
cc_library(
  multi_devices_graph_check_pass
  SRCS multi_devices_graph_check_pass.cc
  DEPS multi_devices_helper)

set(ALL_REDUCE_OP_HANDLES all_reduce_op_handle)
set(ALL_REDUCE_OP_HANDLES grad_merge_all_reduce_op_handle)
if(WITH_GPU AND WITH_DGC)
  list(APPEND ALL_REDUCE_OP_HANDLES sparse_all_reduce_op_handle)
endif()

cc_library(
  multi_devices_graph_pass
  SRCS multi_devices_graph_pass.cc
  DEPS multi_devices_helper
       computation_op_handle
       scale_loss_grad_op_handle
       rpc_op_handle
       fetch_barrier_op_handle
       ${ALL_REDUCE_OP_HANDLES}
       reduce_op_handle
       broadcast_op_handle
       fused_broadcast_op_handle)
cc_library(
  sequential_execution_pass
  SRCS sequential_execution_pass.cc
  DEPS graph graph_helper pass)
cc_library(
  set_reader_device_info_utils
  SRCS set_reader_device_info_utils.cc
  DEPS graph graph_helper pass multi_devices_graph_pass)

cc_library(
  fuse_all_reduce_op_pass
  SRCS fuse_all_reduce_op_pass.cc
  DEPS graph graph_helper fused_all_reduce_op_handle
       grad_merge_all_reduce_op_handle)
cc_library(
  all_reduce_deps_pass
  SRCS all_reduce_deps_pass.cc
  DEPS all_reduce_op_handle graph graph_helper pass)
cc_library(
  backward_optimizer_op_deps_pass
  SRCS backward_optimizer_op_deps_pass.cc
  DEPS graph graph_helper pass)
cc_library(
  add_reader_dependency_pass
  SRCS add_reader_dependency_pass.cc
  DEPS graph graph_helper pass)
cc_library(
  fix_op_run_order_pass
  SRCS fix_op_run_order_pass.cc
  DEPS graph graph_helper multi_devices_helper pass op_handle_base
       eager_deletion_op_handle)
